package com.irdstudio.efp.nls.common.constant;

import java.util.stream.Stream;

/**
 * 马上消费的产品插槽信息
 * 
 * @author huangwb
 * @since 2018年12月28日 下午2:26:52
 * @version 1.0
 */
public enum ZZDAdaptedSoltEnum {

	SOLT_APPLY_ACCESS("1001", "1001", "准入判断服务", "accessService", "1", 1), //
	SOLT_APPLY_PBOC("1001", "1002", "征信判断服务", "pbocService", "1", 2);
	
	private String prdId;// 产品ID
	private String soltCode;// 插槽代码
	private String soltName;// 插槽名称
	private String soltService;// 插槽服务类
	private String soltStage;// 插槽阶段类
	private int soltOrder;// 插槽顺序

	public String getPrdId() {
		return prdId;
	}

	public String getSoltCode() {
		return soltCode;
	}

	public String getSoltName() {
		return soltName;
	}

	public String getSoltService() {
		return soltService;
	}
	
	public String getSoltStage() {
		return soltStage;
	}

	public int getSoltOrder() {
		return soltOrder;
	}

	private ZZDAdaptedSoltEnum(String prdId, String soltCode, String soltName, String soltService, String soltStage, int soltOrder) {
		this.prdId = prdId;
		this.soltCode = soltCode;
		this.soltName = soltName;
		this.soltService = soltService;
		this.soltStage = soltStage;
		this.soltOrder = soltOrder;
	}

	public static ZZDAdaptedSoltEnum parse(String prdId, String soltCode) {
		return Stream.of(ZZDAdaptedSoltEnum.values()).filter(value -> value.prdId.equals(prdId) && value.soltCode.equals(soltCode))
				.findFirst().orElseThrow(RuntimeException::new);

	}

	public boolean validateSoltService(String soltName, String soltService, String soltStage, int soltOrder) {
		return this.soltName.equals(soltName) && this.soltService.equals(soltService) && this.soltStage.equals(soltStage) && this.soltOrder == soltOrder;
	}

}
